package org.peterf.foxish.component;

import org.peterf.foxish.camera.Camera;
import org.peterf.foxish.texture.SlicedTexture;
import org.peterf.foxish.texture.Texture;
import org.peterf.foxish.texture.TextureRepository;

import android.util.Log;

public class Animation extends TexturedRectangle {
    
    public Animation(SlicedTexture texture, int x, int y) {
        super(texture, x, y);
        this.texture = texture;
    }
    
    protected SlicedTexture texture = null;
    
    protected float texCoordinate[] = new float[8];
    
    public void animateTo(int x, int y) {
        texCoordinate[0] = texCoordinate[2] = (float) x / texture.getCountX();
        texCoordinate[1] = texCoordinate[5] = (float) y / texture.getCountY();
        texCoordinate[3] = texCoordinate[7] = (1.0f + y) / texture.getCountY();
        texCoordinate[4] = texCoordinate[6] = (1.0f + x) / texture.getCountX();
        updateTextureCoordinate(texCoordinate, 0, 0);
    }
    
}
